<template>
  <div class="contentWeb clear">
    <div class="member_menu">
      <Memleft active="memLook"/>
    </div>
    <div class="member_right">
      <div class="none_mem" v-if="count * 1 === 0">
        <div style="padding-bottom: 70px;" class="clear">
          <img :src="nonoe" class="noneimg">
          <div>
            还没有人查看你哦！继续努力，别放弃
          </div>
        </div>
      </div>

      <div v-if="count*1 > 0">
        <div class="listcount">共<span>{{count}}个企业</span>看过我</div>
        <el-row :gutter="20">
          <el-col :span="8" v-for="(item, index) in ListList" :key="index" >
            <div class="historytab" @click="tocompany(item.enterpriseUid)">
              <div class="clear">
                <img :src="item.logo">
                <div class="names">
                  <h2>{{item.enterpriseName}}</h2>
                  <div class="desc"><span>{{item.enterpriseNature}}</span><span>{{item.industry}}</span></div>
                </div>
              </div>
              <div class="times">查看时间 {{item.watchTime}}</div>
            </div>
          </el-col>
        </el-row>
        <div style="text-align: center">
          <el-pagination background
            layout="prev, pager, next"
            @current-change="getpost"
            :total="count"
            :page-size="search.pageSize"
            :current-page="search.pageNum"></el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>
<script type="text/babel">
// @ is an alias to /src
import mt from '../../assets/img/mt.png'
import Memleft from '../../components/memleft'
import { WhoWatchMeByPage } from '../../assets/js/domains'
import nonoe from '../../assets/img/weijian.png'
export default {
  name: 'MemLook',
  components: { Memleft },
  directives: {},
  data: function () {
    return {
      count: 0,
      mt: mt,
      nonoe: nonoe,
      ListList: [],
      search: {
        pageNum: 1, pageSize: 12, user_uid: ''
      }
    }
  },
  created: function () {
    document.documentElement.scrollTop = document.body.scrollTop = 0
  },
  computed: {},
  mounted: function () {
    this.search.user_uid = localStorage.getItem('md_user_uid')
    this.getpost()
  },
  methods: {
    add: function () {
    },
    tocompany: function (id) {
      window.location.href = '/companyDetail.html?enterpriseUid=' + id
    },
    getpost: function (page) {
      const _this = this
      page && (this.search.pageNum = page)
      WhoWatchMeByPage(this.search).then(function (res) {
        if (res.code === 200) {
          _this.ListList = res.data.content
          _this.count = res.data.totalElements
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
  @import "../../assets/css/member";
</style>
